<!DOCTYPE html>
<html>
<head>
  <meta charset="UTF-8">
  <title>Document</title>
  <style>
    
  </style>
</head>
<body>
  <img src="../imgs/avatar1.jpg" alt="" class="img1">
  <img src="../imgs/banner2.jpg" alt="" class="img2">
</body>
<script>

  var img1 = document.querySelector(".img1")
  var img2 = document.querySelector(".img2")
  img1.onload = function(){
    console.log(img1.offsetWidth)
  }
  img2.onload = function(){
    console.log(img2.offsetWidth)
  }
  console.log(img1)
  console.log(img2)
  
</script>
</html>